package com.giaothong.database;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class HistoryStudyDAL {
	Context context;
	
	public static final int MODE = Context.MODE_PRIVATE;
	public static final String PRE_STUDY = "indexQuestionHistory";
	public static final String HISTORY_STUDY_MOTO = "moto";
	public static final String HISTORY_STUDY_OTO = "oto";
	public static final String HISTORY_STUDY_BIEN_BAO = "bienbao";
	public static final String HISTORY_STUDY_SA_HINH = "sahinh";
	public static final String HISTORY_STUDY_QUESTION_MARKED = "questionMarked";
	public HistoryStudyDAL(Context con){
		this.context = con;
	}
	public Editor getEditor(){
		return this.context.getSharedPreferences(PRE_STUDY,MODE).edit();
	}
	public void clearHistoryStudy(){
		this.context.getSharedPreferences(PRE_STUDY,MODE).edit().clear().commit();
	}
	public Boolean setHistoryStudyMoto(int valueMoto) {
		Editor edit = this.getEditor();
		edit.putInt(HISTORY_STUDY_MOTO, valueMoto);
		return edit.commit();
	}
	public Boolean setHistoryStudyOto(int value) {
		Editor edit = this.getEditor();
		edit.putInt(HISTORY_STUDY_OTO, value);
		return edit.commit();
	}
	public Boolean setHistoryStudyBienBao(int value) {
		Editor edit = this.getEditor();
		edit.putInt(HISTORY_STUDY_BIEN_BAO, value);
		return edit.commit();
	}
	public Boolean setHistoryStudySaHinh(int value) {
		Editor edit = this.getEditor();
		edit.putInt(HISTORY_STUDY_SA_HINH, value);
		return edit.commit();
	}
	public Boolean setHistoryStudyQuestionMarked(int value){
		Editor edit = this.getEditor();
		edit.putInt(HISTORY_STUDY_QUESTION_MARKED, value);
		return edit.commit();
	}
	
	public int gettHistoryStudyMoto() {
		SharedPreferences pre = this.context.getSharedPreferences(PRE_STUDY, MODE);
		return pre.getInt(HISTORY_STUDY_MOTO, 1);
	}
	public int gettHistoryStudyOto() {
		SharedPreferences pre = this.context.getSharedPreferences(PRE_STUDY, MODE);
		return pre.getInt(HISTORY_STUDY_OTO, 1);

	}
	public int gettHistoryStudyBienBao() {
		SharedPreferences pre = this.context.getSharedPreferences(PRE_STUDY, MODE);
		return pre.getInt(HISTORY_STUDY_BIEN_BAO, 1);

	}
	public int gettHistoryStudySaHinh() {
		SharedPreferences pre = this.context.getSharedPreferences(PRE_STUDY, MODE);
		return pre.getInt(HISTORY_STUDY_SA_HINH, 1);

	}
	public int gettHistoryStudyQuestionMarked() {
		SharedPreferences pre = this.context.getSharedPreferences(PRE_STUDY, MODE);
		return pre.getInt(HISTORY_STUDY_QUESTION_MARKED, 1);
	}
}
